package icom.acm.manager;

import icom.acm.bean.VIEW_USER_USERRELATION;
import icom.acm.util.DBConnect;

import java.util.ArrayList;
import java.util.List;

public class View_User_UserRelationMgr {
	public List<VIEW_USER_USERRELATION> select(int begin, int end, String order){
		List<VIEW_USER_USERRELATION> list = new ArrayList<VIEW_USER_USERRELATION>();
		
		String sql = "SELECT VUUR_U_ID, VUUR_U_NICKNAME, VUUR_UED_CNT, VUUR_U_CNT" +
				" FROM VIEW_USER_USERRELATION ORDER BY " + order + " LIMIT "+begin+"," + end;
		DBConnect db = new DBConnect();
		
		db.prepareStatement(sql);
		db.excuteQuery();
		try {
			while (db.next()){
				VIEW_USER_USERRELATION vuur = new VIEW_USER_USERRELATION(); 
				vuur.setVUUR_U_ID(db.getInt("VUUR_U_ID"));
				vuur.setVUUR_U_NICKNAME(db.getString("VUUR_U_NICKNAME"));
				vuur.setVUUR_UED_CNT(db.getInt("VUUR_UED_CNT"));
				vuur.setVUUR_U_CNT(db.getInt("VUUR_U_CNT"));
				list.add(vuur);
			}
		} catch(Exception ex){ex.printStackTrace();}finally{db.close();}
		return list;
	}
}
